package mytools;

import android.content.Context;
import android.util.Log;

import com.socks.library.KLog;

public class CurrentVersion {
    private static final String appPackage = "com.sxpjyy.monkey.mobilenurse";

    //获取当前版本代码
    public static int getVerCode(Context context) {
        int verCode = -1;
        try {
            verCode = context.getPackageManager().getPackageInfo(appPackage, 0).versionCode;
        } catch (Exception e) {
            KLog.e( e.getMessage());
            e.printStackTrace();
        }
        return verCode;
    }

    //获取当前版本名称
    public static String getVerName(Context context) {
        String verName = "";
        try {
            verName = context.getPackageManager().getPackageInfo(appPackage, 0).versionName;
        } catch (Exception e) {
            KLog.e(e.getMessage());
            e.printStackTrace();
        }
        return verName;
    }
}
